import {config} from "../config/config";
import {promisic} from "../miniprogram_npm/lin-ui/utils/util";

class Http {
    static request({url, data, method = 'GET'}) {
        return Http.req({url, data, method, name:'name'}, wx.request)
    }
    // wx里的方法会自动忽略掉不需要的参数
    static req(params = {}, wx_method) {
        if (params.url)
            params.url = `${config.apiBaseUrl}${params.url}`
        return promisic(wx_method)(params)
    }
}



export {
    Http
}